const path = require("path");
module.exports = {
  configureWebpack: {
    resolve: {
      alias: {
        store: path.resolve(__dirname, "./store"),
        mixins: path.resolve(__dirname, "./mixins"),
        service: path.resolve(__dirname, "./service"),
        components: path.resolve(__dirname, "./components")
      }
    }
  },
  //theme: 'api',
  dest: "Software Version Management",
  base: "/material/",
  locales: {
    "/": {
      lang: "zh-CN",
      title: "Manage of Version",
      description: "The analytical data that you often use to learn"
    }
  },
  port: 8090,
  head: [
    ["link", { rel: "icon", href: `/logo.png` }],
    ["link", { rel: "manifest", href: "/manifest.json" }],
    ["meta", { name: "theme-color", content: "#3eaf7c" }],
    ["meta", { name: "apple-mobile-web-app-capable", content: "yes" }],
    [
      "meta",
      { name: "apple-mobile-web-app-status-bar-style", content: "black" }
    ],
    [
      "link",
      { rel: "apple-touch-icon", href: `/icons/apple-touch-icon-152x152.png` }
    ],
    [
      "link",
      {
        rel: "mask-icon",
        href: "/icons/safari-pinned-tab.svg",
        color: "#3eaf7c"
      }
    ],
    [
      "meta",
      {
        name: "msapplication-TileImage",
        content: "/icons/msapplication-icon-144x144.png"
      }
    ],
    ["meta", { name: "msapplication-TileColor", content: "#000000" }]
  ],
  serviceWorker: true,
  themeConfig: {
    // 侧边栏会自动地显示由当前页面的标题（headers）组成的链接,默认深度是1
    sidebarDepth:1,
    displayAllHeaders: false, // 默认值：false
    activeHeaderLinks: true, // 默认值：true
    editLinks: true,
    docsDir: "docs",
    locales: {
      "/": {
        label: "简易中文",
        selectText: "选择语言",
        editLinkText: "在GitHub上编辑此页",
        nav: [
          {
            text: "基础",
            link: "/basic/"
          },
          {
            text: "问题",
            link: "/defect/"
          },
          {
            text: "优化",
            link: "/amend/"
          },
          {
            text: "版本",
            link: "/version/"
          }
        ],
        sidebar: {
          "/amend/": genSidebarConfigAuto("amend", "docs/amend/"),
          "/defect/": genSidebarConfigAuto("defects", "docs/defect/"),
          "/version/": genSidebarConfigAuto("version", "docs/version/")
        }
      }
    }
  },
  markdown: {
    config: md => {
      md.use(require("markdown-it-math"));
    }
  }
};
function genSidebarConfig(title) {
  return [
    {
      title,
      collapsable: false,
      children: ["assets"]
    }
  ];
}
function genSidebarConfigAuto(title, dir) {
  let children = configReportModule(dir);
  return [
    {
      title,
      collapsable: false,
      children: children
    }
  ];
}
function configReportModule(dir) {
  let children = [];
  children.push("");
  children.push("info");
  children.push("search");
  children.push("report");
  return children;
}
